package cn.czh0123.controller;

import cn.czh0123.domain.User;
import cn.czh0123.service.IUserService;
import cn.czh0123.utils.ResultWrapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
* 用户控制层
*/
@RestController
@RequestMapping("users")
public class UserController {

    @Resource
    private IUserService userService;

    @PostMapping("/doLogin")
    public ResultWrapper<User> doLogin(@RequestBody User user) {
        return ResultWrapper.success(userService.login(user));
    }

    @PostMapping("/doRegister")
    public ResultWrapper<User> doRegister(@RequestBody User user) {
        return ResultWrapper.success(userService.register(user));
    }
}
